<template >
    <div>
        <!-- <div class="v-modal" @click.stop="dialogVisible = false" :style="dialogVisible?'z-index: 1990;':'z-index:-1;'"></div> -->
        <div class="c-header">
            <ul class="content1">
                <li class="item active">
                    <div>{{ info.title }}</div>
                    <div class="line"></div>
                </li>
            </ul>
        </div>
        <div class="c-center" v-if="info.isHead">
            <div class="top">
                <div class="box1">
                    <span>项目: </span>
                    <ul class="list">
                        <!-- <li :class="{ active: subjectActive == '0' }">全部</li> -->
                        <li @click="selectCol(index, item)" v-for="(item, index) in subjectList"
                            :class="{ active: subjectActive == index }" :key="index">
                            {{ item.name }}
                        </li>
                    </ul>
                </div>
                <div class="box1">
                    <span class="special">科目: </span>
                    <ul class="list">
                        <li v-for="(item, index) in subjectChildList" :key="index" @click="majorClick(index, item)"
                            class="item-kc" :class="{ active: majorActive == index }">
                            <div>
                                {{ item.name }}
                            </div>
                        </li>
                    </ul>
                </div>
                <div class="box1" v-if="info.id != 'startAnswer' || info.id != 'answerList'">
                    <span class="special">年份: </span>
                    <ul class="list">
                        <li v-for="(item, index) in years" :key="index" @click="yearClick(index, item)"
                            class="item-kc" :class="{ active: yearActive == item }">
                            <div>
                                {{ item }}
                            </div>
                        </li>
                    </ul>
                </div>
                <div class="box1" v-if="info.id == 'startAnswer' || info.id == 'answerList'">
                    <span class="special">试卷类型: </span>
                    <ul class="list">
                        <li v-for="(item, index) in testpaper" :key="index" @click="testpaperClick(index, item)"
                            class="item-kc" :class="{ active: activeTestpaper == index }">
                            <div>
                                {{ item.name }}
                            </div>
                        </li>
                    </ul>
                    <!-- <span class="special">
						试卷类型：
					</span>
					<div class="list">
						<div class="item" @click="activeClick('testpaperTypeId',item.config_id,'getTestpaperList',item)" :class="{active: testpaperTypeId == item.config_id}" v-for="(item,index) in testpaper" :key="index">
							<span>{{item.name}}</span>
						</div>
					</div> -->
                </div>
            </div>
        </div>
        <div style="width: 100%;height: 32px;" v-if="!info.isHead"></div>
        <div v-if="myvideoList.length == 0" class="c-body">
            <div class="conImg">
                <img src="../../../assets/image/pic_learning_class_deaful.png" />
                <div class="conBotton">
                    <span>暂时没有数据~</span>
                    <!-- <a @click="gobuy">马上去购买</a> -->
                </div>
            </div>
        </div>
        <!-- 表格 -->
        <div class="c-body" v-if="gridOptions[info.id]">
            
            <el-button v-if="btnsPower[info.id]&&btnsPower[info.id].indexOf('add')>-1" size="small" @click="add">添加</el-button>
         <div style="width: 100%;height: 32px;" ></div>

            <vxe-grid ref="xGrid" v-bind="{...gridOptions.public,...gridOptions[info.id]}" @page-change="handlePageChange">
            
                <template #operate="{ row }">
                    <div style="width: 100;height: 100%; display: flex;justify-content: space-around;align-items: center;">
                        <el-button v-if="btnsPower[info.id]&&btnsPower[info.id].indexOf('edit')>-1" type="primary"  size = "mini" icon="el-icon-edit" title="编辑" circle @click="editRow(row)"></el-button>
                        <el-button v-if="btnsPower[info.id]&&btnsPower[info.id].indexOf('delete')>-1" type="danger" size = "mini" icon="el-icon-delete" title="删除" circle @click="deleteRow(row[idKeys[info.id]])"></el-button>
                        <el-button v-if="btnsPower[info.id]&&btnsPower[info.id].indexOf('details')>-1" type="warning" size = "mini" icon="el-icon-document" title="详情" circle @click="detailsRow(row)"></el-button>
                    </div>
                    
                    <!-- <vxe-button title="编辑" circle @click="editRow(row)">编辑</vxe-button>
                    <vxe-button title="删除" circle @click="deleteRow(row)">删除</vxe-button>
                    <vxe-button title="详情" circle @click="detailsRow(row)">详情</vxe-button> -->
                </template>
                
                <template #normal_default="{ row }">
                    <span>{{ row.normal == 1?'是':'否' }}</span>
                </template>
                <template #onLineAnswer_status="{ row }">
                    <span>{{ row.status == 1?'已回复':'未回复' }}</span>
                </template>
                <template #image_default="{ row }">
                    <div style="width: 100%;height: 100%;display: flex;align-items: center;justify-content: center;">
                        <img @click = "imageClick(row.image)" v-if="row.image" :src="row.image" style="width: 40px;height: 40px;" alt="">
                        <span v-else>-</span>
                    </div>
                    
                </template>
                
            </vxe-grid>
        </div>
        <div class="c-body" v-if="info.isHead&&lists[info.id]&&lists[info.id].length != 0">
            <span v-for="(item, index) in lists[info.id]" :key="index">
                <span @click="activeHead = index" :class="activeHead == index ? 'activehong yangshi' : 'yangshi'">
                    {{ item.tixing }}</span>
            </span>
            <div class="list" v-if="info.id != 'errAnswer'&&info.id != 'collectAnswer'">
                <ul>
                    <li v-for="(item, index) in lists[info.id]" :key="index">
                        <span class="tab1">{{ listKey[info.id].name?listKey[info.id].name(item):'' }}</span>
                        <span class="tab3" v-if="listKey[info.id]&&listKey[info.id].label">{{listKey[info.id].label(item)}}{{ listKey[info.id].key?'：'+item[listKey[info.id].key]:'' }}</span>
                        <span class="tab4" style="display: flex;">
                            <span v-if = "listKey[info.id].btnVal1" class="btn" style = "flex: 1; background-color:#ccc;" @click="startToLearn(item,1)">{{ listKey[info.id].btnVal1 }}</span>
                            <span v-if = "info.id == 'startStudy'&&item.handout" class="btn" style = "flex: 1; background-color:#ccc;" @click="listKey[info.id].btn1Fun(item.handout,'jiangyiShow')">{{ '下载讲义' }}</span>
                            <span v-if = "listKey[info.id].btnVal" :style = "listKey[info.id].btnVal1?'flex:1;':'flex:1;'" class="btn" @click="startToLearn(item,0)">{{ listKey[info.id].btnVal }}</span>
                        </span>
                    </li>
                </ul>
            </div>
            <!-- <div class="list" v-else>
                <ul>
                    <li v-for="(item, index) in lists[info.id][activeHead].data" :key="index">
                        <span class="tab1" style="flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;" >{{ item.testpaper&&item.testpaper.name?item.testpaper.name:'' }}</span>
                        <span class="tab3" style="flex: 2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;" >{{ item.stem?item.stem:'' }}</span>
                        <span class="tab4" style="display: flex;">
                            <span v-if = "listKey[info.id].btnVal1" class="btn" style = "flex: 1; background-color:#ccc;" @click="startToLearn(item,1)">{{ listKey[info.id].btnVal }}</span>
                            
                            <span :style = "listKey[info.id].btnVal1?'flex:1;':'flex:1;'" class="btn" @click="startToLearn(item,0)">{{ listKey[info.id].btnVal }}</span>
                        </span>
                    </li>
                </ul>
            </div> -->
			<!-- <el-cascader style="width:100%" clearable v-model="area" :options="threeAddressOptions"></el-cascader> -->

        </div>
        <!-- <div class="c_body" v-else>
            {{ lists[info.id] }}
            {{ info.id }}
            
            <div class="list" >
                <ul>
                    <li v-for="(item, index) in lists[info.id]" :key="index">
                        <span class="tab1">{{ listKey[info.id].name?listKey[info.id].name(item):'' }}</span>
                        <span class="tab3" v-if="listKey[info.id]&&listKey[info.id].label">{{listKey[info.id].label(item)}}{{ listKey[info.id].key?'：'+item[listKey[info.id].key]:'' }}</span>
                        <span class="tab4" style="display: flex;">
                            <span v-if = "listKey[info.id].btnVal1" class="btn" style = "flex: 1; background-color:#ccc;" @click="startToLearn(item,1)">{{ listKey[info.id].btnVal1 }}</span>
                            
                            <span v-if = "listKey[info.id].btnVal" :style = "listKey[info.id].btnVal1?'flex:1;':'flex:1;'" class="btn" @click="startToLearn(item,0)">{{ listKey[info.id].btnVal }}</span>
                        </span>
                    </li>
                </ul>
                </div>
        </div> -->

        <!-- <div class="c-body" v-if="this.info.id == 'myContract'">
            <vue-esign ref="esign" :width="800" :height="300" :isCrop="isCrop" :lineWidth="lineWidth" :lineColor="lineColor"
                :bgColor.sync="bgColor" />
            <img :src="resultImg" alt="" style="width: 80px;height: 30px;">

            <button @click="handleReset">清空画板</button>

            <button @click="handleGenerate">生成图片</button>
        </div> -->
        <!-- 我的合同 -->
        <div class="c-body" style="background-color: transparent;box-shadow:none; padding: 0;" v-if="info.id == 'myContract'">
            <myContract ref="myContract"></myContract>
        </div>
        <div class="c-body" v-if="isForm[info.id]">
            <formBox ref="formBox" @submit = "submit" :form = "form[info.id]" :formData = "formData[info.id]" :rules = "rules[info.id]"></formBox>

            <div v-if="info.id != 'information'" class="btn" style="width: 100%;display: flex;justify-content: center;margin-top: 30px;">
                <el-button size = "small" @click = "submitClick">提交</el-button>
            </div>
        </div>
        <el-dialog :show-close="false" title="讲义"
            :visible="jiangyiShow" width="80%"  destroy-on-close>
            <!-- <img :src="defaultImage" alt="" style="width: 100%;height: 100%;"> -->
            <div class="list" >
                <ul>
                    <li v-for="(item, index) in jiangyiDatas" :key="index">
                        <span class="tab1">{{ item.name }}</span>
                        <span class="tab4" style="display: flex;">
                            <span v-if = "item.url" class="btn" style = "flex: 1; background-color:#ccc;" ><a style="color: #fff;" target="_blank" :href="item.url" >下载讲义</a></span>
                        </span>
                    </li>
                </ul>
            </div>
            <span slot="footer" class="dialog-footer ">
                <el-button size="small" @click="jiangyiShow = false">关闭</el-button>
                <!-- <div class="btn">
                    <el-button size="small" @click="submitClick">提交</el-button>
                </div> -->
            </span>
        </el-dialog>
        <el-dialog :show-close="false" title="预览"
            :visible="imageDig" width="80%"  destroy-on-close>
            <img :src="defaultImage" alt="" style="width: 100%;height: 100%;">
            <span slot="footer" class="dialog-footer ">
                <el-button size="small" @click="imageDig = false">关闭</el-button>
                <!-- <div class="btn">
                    <el-button size="small" @click="submitClick">提交</el-button>
                </div> -->
            </span>
        </el-dialog>
        <el-dialog @open="open" :show-close="false"
            :title="`${info.title}${formDisabled == 'details' ? '' : formDisabled == 'add' ? '' : ''}`"
            :visible="dialogVisible" width="60%">
            <scoreAdd ref="scoreAdd" v-if="info.id == 'score'" @submit="submit" ></scoreAdd>
            <formBox v-if="info.id != 'score'" ref="formBox" @submit="submit" :form="form[info.id]" :formData="formData[info.id]"
                :rules="rules[info.id]"></formBox>
            <span slot="footer" class="dialog-footer ">
                <el-button size="small" @click="dialogVisible = false">取 消</el-button>
                <div class="btn">
                    <el-button size="small" @click="submitClick">提交</el-button>
                </div>
            </span>
        </el-dialog>
    </div>
</template>
<script>
import threeAddressOptions from "../../../assets/js/city-data-level3"
import { bus } from '../../../main.js';
import pagePublic from "@/mixins/pagePublic.js";
import { mapMutations, mapState } from "vuex";
import formBox from "./form.vue";
import options from "../../../assets/js/city-data-level3";
import scoreAdd from "./scoreAdd.vue";
import myContract from "./myContract.vue";
const dete = new Date();
const aaa = "[{\"url\":\"http:\\/\\/zcjy2023.oss-cn-hangzhou.aliyuncs.com\\/admin\\/202405\\/202405132022120172827.txt\",\"name\":\"新建文本文档.txt\"},{\"url\":\"http:\\/\\/zcjy2023.oss-cn-hangzhou.aliyuncs.com\\/admin\\/202405\\/202405132022360150198.doc\",\"name\":\"工人南路支行付款申请.doc\"}]"
export default {
    name: "tem",
    mixins: [pagePublic],
    components: { formBox,scoreAdd,myContract },
    props: {

    },
    data() {
        let reg_tel = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/;    //11位手机号码正则
        let validatorPhone = (rule, value, callback) => {
            console.log(reg_tel.test(value))

            if (value === '') {
                callback(new Error('请输入手机号'))
            } else if (!reg_tel.test(value)) {
                callback(new Error('手机号格式错误'))
            } else {
                callback()
            }
        }
        return {
            jiangyiDatas:[],
            jiangyiShow:false,
            testpaper:[],
            testpaperTypeId:'',
            activeTestpaper:0,
            years:[new Date().getFullYear(),new Date().getFullYear()-1],
            yearActive:new Date().getFullYear(),
            uploadUrl:"",
            imageDig:false,
            defaultImage:'',
            formDisabled: 'details',
            subjectActive:0,
            majorActive:0,
            projectid:'',
            subjectId:'',
            dialogVisible: false,
            threeAddressOptions: threeAddressOptions,
            area: [],
            info: {},
            lineWidth: 6,
            lineColor: '#000000',
            bgColor: '',
            resultImg: '',
            isCrop: false,
            subjectList: [],
            subjectChildList: [],
            activeHead:0,
            myvideoList: [
                {
                    kx_name: 'zasas',
                    bt: '',
                    teacher: '',
                    id: ''
                }
            ],
            kcList: [
                {
                    bt: "科目一",
                    teacher: "李四",
                }
            ],

            isForm:{
                information:{},
                address:{},
                editPwd:{},
                editDel:{},
                // myContract:{},
            },
            // 表单数据
            form: {
                onLineAnswer: {
                    project:'',
                    subject:'',
                    name:'',
                    content:'',

                },//在线答疑
                onLineComplaint: {
                    config_id:'',
                    content:'',
                    image:'',

                },//在线投诉
                onLineTeacher: {
                    config_id:'',
                    normal:[],
                    often:'',

                    content:'',

                },//在线班主任
                studyPlan: {
                    stime: '',
                    etime: '',
                    plan: '',

                },//学习计划
                score: {},//考试成绩
                msgProd: {},//消息提醒
                information:{
                    name:'',
                    username:'',
                    // deMobile1: localStorage.getItem('userInfo')?JSON.parse(localStorage.getItem('userInfo')).mobile.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2'):'',
                    mobile:'',
                    sex:'',
                    education:'',

                },
                address: {
                    name: '',
                    area: '',
                    address: '',
                    mobile: '',
                    phone: '',
                    post: '',
                    often: 1,
                },//收货地址
                editPwd: {
                    password: '',
                    newpassword: '',
                    newpassword2: '',
                },//修改密码
                // onLineAnswer: {},//在线答疑
                editDel: {
                    // deMobile:localStorage.getItem('userInfo')?JSON.parse(localStorage.getItem('userInfo')).mobile:'',
                    // deMobile1: localStorage.getItem('userInfo')?JSON.parse(localStorage.getItem('userInfo')).mobile.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2'):'',
                    password: '',
                    mobile: '',
                    key: '',
                    code: '',
                },//修改手机号
                myContract: {},//我的合同
            },
            // 表单规则
            rules: {
                onLineAnswer: {
                    project: [{ required: true, message: '请选择项目', trigger: 'change' }],
                    subject: [{ required: true, message: '请选择科目', trigger: 'change' }],
                    name: [{ required: true, message: '请输入标题', trigger: 'blur' }],
                    content: [{ required: true, message: '请输入问题详细描述', trigger: 'blur' }],
                },//在线答疑
                onLineComplaint: {
                    config_id: [
                        { required: true, message: '请选择问题分类', trigger: 'change' },
                    ],
                    content: [
                        { required: true, message: '请描述需要遇到的问题', trigger: 'blur' },
                    ],
                },//在线投诉
                onLineTeacher: {
                    config_id: [
                        { required: true, message: '请选择课程分类', trigger: 'change' },
                    ],
                },//在线班主任
                studyPlan: {
                    stime: [
                        { required: true, message: '请选择学习计划开始日期', trigger: 'change' },
                    ],
                    etime: [
                        { required: true, message: '请选择学习计划结束日期', trigger: 'change' },
                    ],
                    plan: [
                        { required: true, message: '请输入我的学习计划', trigger: 'blur' },
                    ],
                },//学习计划
                score: {},//考试成绩
                msgProd: {},//消息提醒
                address: {
                    name: [
                        { required: true, message: '请输入您的真实姓名', trigger: 'blur' },
                    ],
                    area: [
                        { required: true, message: '请选择所在地区', trigger: 'change' },
                    ],
                    address: [
                        { required: true, message: '请输入真实有效的详细地址', trigger: 'blur' },
                    ],
                    post: [
                        { required: true, message: '请输入您所在城市的邮政编码', trigger: 'blur' },
                    ],
                },//收货地址
                editPwd: {
                    password: [
                        { required: true, message: '请输入原密码', trigger: 'blur' },
                        { min: 6, max: 20, message: '请输入长度6-20的密码', trigger: ['change', 'blur'] }
                    ],
                    newpassword: [
                        { required: true, message: '请输入新密码', trigger: 'blur' },
                        { min: 6, max: 20, message: '请输入长度6-20的密码', trigger: ['change', 'blur'] }
                    ],
                    newpassword2: [
                        { required: true, message: '请再次输入新密码', trigger: 'blur' },
                        { min: 6, max: 20, message: '请输入长度6-20的密码', trigger: ['change', 'blur'] }
                    ],
                },//修改密码
                // onLineAnswer: {},//在线答疑
                editDel: {
                    password: [{ required: true,  message: '请输入登录密码',  trigger: 'blur' }],
                    mobile: [
                        { required: true, validator: validatorPhone,trigger: ['blur','change'] },
                        // { pattern: /^1[3456789]\d{9}$/, message: '手机号格式不正确', trigger: ['blur'] }
                    ],
                    code: [{ required: true, message: '请输入新手机号验证码', trigger: 'blur' }],
                },//修改手机号
                myContract: {},//我的合同
            },
            // 表单遍历数据
            formData: {
                onLineAnswer: [
                    {
                        type: 'selectCol',
                        prop: 'project',
                        prop1: 'project1',
                        prop2: 'project2',
                        placeholder: '请选择项目',
                        label: '项目：',
                        labelKey:'name',
                        valueKey:'config_id',
                    },
                    {
                        type: 'selectCol1',
                        prop: 'subject',
                        placeholder: '请选择科目',
                        label: '科目：',
                        labelKey:'name',
                        valueKey:'config_id',
                    },
                    {
                        type: 'textarea',
                        prop: 'name',
                        placeholder: '请输入问题标题',
                        label: '问题标题：'
                    },
                    {
                        type: 'WangEditor',
                        prop: 'content',
                        placeholder: '请输入问题详细描述',
                        label: '问题详细描述：'
                    },
                ],//在线答疑
                onLineComplaint: [
                    {
                        type: 'select',
                        prop: 'config_id',
                        placeholder: '请选择问题分类',
                        label: '问题分类：',
                        labelKey:'name',
                        valueKey:'config_id',
                        options:[]
                    },
                    {
                        type: 'textarea',
                        prop: 'content',
                        placeholder: '请描述需要咨询的问题',
                        label: '问题描述：'
                    },
                    {
                        type: 'upload',
                        prop: 'image',
                        label: '上传凭证：',
                        change:(file,fileList,it)=>{
                            try {
                                console.log(file.response.data,fileList,it,'upload111111')
                                it.image = file.response.data;
                                this.uploadUrl = file.response.data?file.response.data:''
                                console.log(this.uploadUrl,22222)
                                this.$refs.formBox.setImageUrl(this.uploadUrl)
                            } catch (error) {
                                
                            }
                            

                        }
                    },
                    
                ],//在线投诉
                onLineTeacher: [
                    {
                        type: 'select',
                        prop: 'config_id',
                        placeholder: '请选择课程分类',
                        label: '课程分类：',
                        labelKey:'name',
                        valueKey:'config_id',
                        options:[]
                    },
                    {
                        type: 'select1',
                        prop: 'normal',
                        label: '勾选问题：',
                        labelKey: 'label',
                        valueKey: "value",
                        options: []
                    },
                    {
                        type: 'textarea',
                        prop: 'content',
                        placeholder: '请描述需要咨询的内容',
                        label: '我要咨询：'
                    },
                ],//在线班主任
                studyPlan: [
                    {
                        type: 'datePicker',
                        prop: 'stime',
                        placeholder: '请选择学习计划开始日期',
                        label: '学习计划开始日期：',
                        date:'datetime',
                        format:'yyyy-MM-dd HH:mm:ss',
                    },
                    {
                        type: 'datePicker',
                        prop: 'etime',
                        placeholder: '请选择学习计划结束日期',
                        label: '学习计划结束日期：',
                        date:'datetime',
                        format:'yyyy-MM-dd HH:mm:ss',


                    },
                    {
                        type: 'textarea',
                        prop: 'plan',
                        placeholder: '请输入我的学习计划',
                        label: '我的学习计划：'
                    },
                ],//学习计划
                score: [],//考试成绩
                msgProd: [],//消息提醒
                information:[
                    {
                        type: 'div',
                        prop: 'name',
                        label: '学员名称：',
                    },
                    {
                        type: 'div',
                        prop: 'username',
                        label: '学员账号：',
                    },
                    {
                        type: 'div',
                        prop: 'mobile',
                        label: '手机号：',
                    },
                    {
                        type: 'div',
                        prop: 'sex',
                        label: '性别：',
                    },
                    {
                        type: 'div',
                        prop: 'education',
                        label: '学历：',
                    },
                    
                ],
                address: [
                    {
                        type: 'input',
                        prop: 'name',
                        placeholder: '请输入您的真实姓名',
                        label: '收货人：',
                    },
                    {
                        type: 'cascader',
                        prop: 'area',
                        placeholder: '请选择所在地区',
                        label: '所在地区：',
                        options: threeAddressOptions,
                    },
                    {
                        type: 'input',
                        prop: 'address',
                        placeholder: '请输入真实有效的详细地址',
                        label: '详细地址：',
                    },
                    {
                        type: 'input',
                        prop: 'mobile',
                        placeholder: '请输入真实有效的手机号码',
                        label: '手机号码：',
                    },
                    {
                        type: 'input',
                        prop: 'phone',
                        placeholder: '请输入固定电话',
                        label: '固定电话：',
                    },
                    {
                        type: 'input',
                        prop: 'post',
                        placeholder: '请输入您所在城市的邮政编码',
                        label: '邮政编码：',
                    },
                    // {
                    //     type: 'checkbox',
                    //     prop: 'often',
                    //     placeholder: '请输入您所在城市的邮政编码',
                    //     label: ' ',
                    //     labelKey: 'label',
                    //     valueKey: "value",
                    //     options: [
                    //     {
                    //         value: '1',
                    //         label: '设为常用地址'
                    //     }
                    //     ]
                    // },
                ],//收货地址
                editPwd: [
                    {
                        type: 'input',
                        prop: 'password',
                        placeholder: '请输入6-20位的当前密码',
                        label: '当前密码：',
                        iptType: 'pwd',
                    },
                    {
                        type: 'input',
                        prop: 'newpassword',
                        placeholder: '请输入6-20位的新密码',
                        label: '新密码：',
                        iptType: 'pwd',

                    },
                    {
                        type: 'input',
                        prop: 'newpassword2',
                        placeholder: '请输入',
                        label: '确认新密码：',
                        iptType: 'pwd',
                    },

                ],//修改密码
                // onLineAnswer: [],//在线答疑
                editDel: [
                    // {
                    //     type: 'div',
                    //     prop: 'deMobile1',
                    //     label: '原手机号：'
                    // },
                    {
                        type: 'input',
                        prop: 'password',
                        placeholder: '请输入登录密码',
                        label: '登录密码：',
                        iptType: 'pwd',

                    },
                    {
                        type: 'input',
                        prop: 'mobile',
                        placeholder: '请输入新手机号',
                        label: '新手机号：'
                    },
                    {
                        type: 'input',
                        prop: 'code',
                        placeholder: '请输入新手机号验证码',
                        label: '新手机号验证码：'
                    }
                ],//修改手机号
                myContract: [],//我的合同
            },
            api: { ...this.$api.study },
            paramsKey:{
                // 开始学习
                startStudy:{
                    list:{
                        projectid:'project',//项目分类id
                        subjectId:'subject',//科目分类id
                        yearActive:'year',//年份
                        
                    },
                },
                // 学习记录
                studyList:{
                    list:{
                        projectid:'project',//项目分类id
                        subjectId:'subject',//科目分类id
                        yearActive:'year',//年份
                    },
                   
                },
                // 开始答题
                startAnswer:{
                    list:{
                        projectid:'project',//项目分类id
                        subjectId:'subject',//科目分类id
                        // yearActive:'year',//年份
                    },
                    query:{
                        // type:0,
                        limit:99,
                        page:1,
                    }
                },
                // 答题记录
                answerList:{
                    list:{
                        projectid:'project',//项目分类id
                        subjectId:'subject',//科目分类id
                        // yearActive:'year',//年份
                    },
                    query:{
                        // type:0,
                        limit:99,
                        page:1,
                    }
                },
                // 我的收藏
                collectAnswer:{
                    // list:{
                    //     projectid:'project',//项目分类id
                    //     subjectId:'subject',//科目分类id
                    //     yearActive:'year',//年份
                    // },
                    query:{
                        type:1,
                    }
                },
                // 错题本
                errAnswer:{
                    // list:{
                    //     projectid:'project',//项目分类id
                    //     subjectId:'subject',//科目分类id
                    //     yearActive:'year',//年份
                    // },
                    query:{
                        type:0,
                    }
                }
            },
            lists:{
                // 开始学习
                startStudy:[],
                // 学习记录
                studyList:[],
                 // 开始答题
                 startAnswer:[],
                // 答题记录
                answerList:[],
                // 我的收藏
                collectAnswer:[],
                 // 错题本
                 errAnswer:[],
            },
            checkboxs:{
                onLineTeacher:[
                    {
                        value: '1',
                        label: '无法正常听课的问题'
                    }
                ],
                address:[
                    {
                        value: '1',
                        label: '设为常用地址'
                    }
                ]
            },
            idKeys:{
                onLineAnswer:"dayi_id",//在线答疑
                onLineComplaint:'complaint_id',//在线投诉
                onLineTeacher:'question_id',//在线班主任
                studyPlan:'plan_id',//学习计划
                score:'scores_id',//考试成绩
                msgProd:'plan_id',//消息提醒
                address:'plan_id',//收货地址
                editPwd:'plan_id',//修改密码
                // onLineAnswer:'plan_id',//在线答疑
                editDel:'plan_id',//修改手机号
                myContract:'userpact_id',//我的合同

            },
            gridOptions:{
                public:{
                    border: true,
                    resizable: true,
                    showOverflow: true,
                    height: 500,
                    align: 'center',
                    loading: false,
                    // 'cell-class-name':'vxe-cell1',
                    // "cell-style":{
                    //     "display": "flex",
                    //     "align-items": "center"
                    // },
                    editConfig: {
                        // 设置触发编辑为手动模式
                        trigger: 'manual',
                        // 设置为整行编辑模式
                        mode: 'row',
                        // 显示修改状态和新增状态
                        showStatus: true,
                        // 自定义可编辑列头的图标
                        icon: 'vxe-icon-question-circle-fill'
                    },
                    
                },
                onLineAnswer:{//在线答疑
                    pagerConfig: {
                        total: 0,
                        currentPage: 1,
                        pageSize: 10,
                        pageSizes: [10, 20, 50, 100, 200, 500]
                    },
                    columns: [
                        { field: 'project', title: '项目' },
                        { field: 'subject', title: '科目', },
                        { field: 'name', title: '标题', },
                        { field: 'content', title: '问题描述', },
                        { field: 'huifu', title: '回复内容', },
                        { field: 'huifu_time', title: '回复时间', },
                        { field: 'adminuser', title: '回复人', },

                        { field: 'status', title: '状态',slots: { default: 'onLineAnswer_status' } },
                        
                        { title: '操作', width: 120, slots: { default: 'operate' } }
                    ],
                    data: []
                },
                onLineComplaint:{//在线投诉
                    pagerConfig: {
                        total: 0,
                        currentPage: 1,
                        pageSize: 10,
                        pageSizes: [10, 20, 50, 100, 200, 500]
                    },
                    columns: [
                        { field: 'config.name', title: '问题分类' },
                        { field: 'content', title: '问题描述', },
                        { field: 'image', title: '凭证',slots: { default: 'image_default' } },
                        { title: '操作', width: 120, slots: { default: 'operate' } }
                    ],
                    data: []
                },
                onLineTeacher:{//在线班主任
                    pagerConfig: {
                        total: 0,
                        currentPage: 1,
                        pageSize: 10,
                        pageSizes: [10, 20, 50, 100, 200, 500]
                    },
                    columns: [
                        { field: 'config.name', title: '课程分类' },
                        { field: 'normal', title: '是否上无法听课问题', slots: { default: 'normal_default' }},
                        { field: 'content', title: '咨询内容', },
                        { title: '操作', width: 120, slots: { default: 'operate' } }
                    ],
                    data: []
                },
                studyPlan:{//学习计划
                    pagerConfig: {
                        total: 0,
                        currentPage: 1,
                        pageSize: 10,
                        pageSizes: [10, 20, 50, 100, 200, 500]
                    },
                    columns: [
                        { field: 'stime', title: '开始时间' },
                        { field: 'etime', title: '结束时间', },
                        { field: 'plan', title: '学习计划', },
                        { title: '操作', width: 120, slots: { default: 'operate' } }
                    ],
                    data: []
                },
                score:{//考试成绩
                    pagerConfig: {
                        total: 0,
                        currentPage: 1,
                        pageSize: 10,
                        pageSizes: [10, 20, 50, 100, 200, 500]
                    },
                    columns: [
                        { field: 'config.name', title: '考试项目' },
                        { field: 'number', title: '准考证号', },
                        { field: 'province', title: '考试省份', },
                        { field: 'exam_time', title: '考试时间', },
                        { title: '操作', width: 120, slots: { default: 'operate' } }
                    ],
                    data: []
                },
                // myContract:{//我的合同
                //     pagerConfig: {
                //         total: 0,
                //         currentPage: 1,
                //         pageSize: 10,
                //         pageSizes: [10, 20, 50, 100, 200, 500]
                //     },
                //     columns: [
                //         { field: 'name', title: '课程分类' },
                //         { field: 'nickname', title: '类型详细', },
                //         { field: 'sex', title: '描述', },
                //         { title: '操作', width: 120, slots: { default: 'operate' } }
                //     ],
                //     data: []
                // }


            },
            btnsPower:{
                // ['add','edit','delete','details']
                onLineComplaint:['add','details'],
                onLineTeacher:['add','details'],
                score:['add','edit','delete','details'],
                studyPlan:['add','edit','delete','details'],
                onLineAnswer:['add','details']

            },
            config:{
                // onLineAnswer:[],
                onLineComplaint:[this.$api.home.config,{category_id:22}],
                onLineTeacher:[this.$api.home.config,{category_id:21}],

            },
            configData:{
                onLineComplaint:[],
                onLineTeacher:[],

            },
            listKey:{
                // 开始学习
                "startStudy":{
                    name:(item)=>{
                        return item.course_name?item.course_name:'-' 
                    },
                    // key:"score",
                    label:(item)=>{
                        return `讲师:${item.teacher_name}`
                    },
                    // btnVal1:"下载讲义",
                    btn1Fun:(item,show)=>{
                        console.log(item,22222)
                        this.jiangyiDatas = item?JSON.parse(item):[]
                        // this.jiangyiDatas = JSON.parse(aaa)

                        this[show] = true;
                    },
                    btnVal:"开始学习"
                },
                // 学习记录
                "studyList":{
                    name:(item)=>{
                        return item.course?item.course.name:'-' 
                    },
                    // key:"score",
                    label:(item)=>{
                        return `讲师:${item.teacher_name}   已看:${item.progress}`
                    },
                    // btnVal:"继续学习"
                },
                // 答题记录
                "answerList":{
                    name:(item)=>{
                        return item.testpaper&&item.testpaper.name?item.testpaper.name:'-' 
                    },
                    // key:"score",
                    // label:(item)=>{
                    //     return ''
                    //     // return `讲师:${item.student&&item.student.name?item.student.name:''}`
                    // },
                    btnVal1:"查看解析",
                   
                    btnVal:"去做题"
                },
                // 开始答题
                "startAnswer":{
                    name:(item)=>{
                        return item.name?item.name:'-' 
                    },
                    key:"num",
                    label:()=>{
                        return '总题数'
                    },
                    btnVal:"开始做题"
                },
                
                // 我的收藏
                collectAnswer:{
                    name:(item)=>{
                        return item.testpaper&&item.testpaper.name?item.testpaper.name:'-' 
                    },
                    // key:"score",
                    label:(item)=>{
                        return `总${item.num}题/对${item.correct}题  正确率 ${item.rate}`
                    },
                    btnVal1:"查看解析",

                    btnVal:"去做题"
                },
                // 错题本
                "errAnswer":{
                    name:(item)=>{
                        return item.testpaper&&item.testpaper.name?item.testpaper.name:'-' 
                    },
                    // key:"score",
                    label:(item)=>{
                        // /错${}道  未答：${}道 
                        return `总${item.num}题/对${item.correct}题 正确率 ${item.rate}`
                    },

                    btnVal:"查看解析"
                }

            },
            // api/config/index


        }
    },
    watch: {
        area(val) {
            console.log(val, 11111)
        }
    },
    computed: {
        ...mapState(['configInfo']),

    },
    created() {

    },
    methods: {
        ...mapMutations(['set_configInfo']),
        init(e) {
            this.subjectActive = 0
            this.majorActive = 0
            this.activeTestpaper = 0
            this.projectid = ''
            this.subjectId = ''
            this.testpaperTypeId = ''
            this.info = JSON.parse(e);
            console.log(e, 11111)
            // if(this.info.id == 'address'){
            //     let url = this.info.id == 'address'?this.api[this.info.id].get:this.api[this.info.id]
            //     url().then((res)=>{
            //         console.log(res,11111)
            //     })
            // }
            // console.log(this.btnsPower[this.info.id],this.btnsPower[this.info.id]['add'],2222222222223333333)
            // console.log(this.info.id,this.gridOptions,this.gridOptions['onLineAnswer'],this.gridOptions[this.info.id],this.info, this.form[this.info.id], this.formData[this.info.id], 'infoinfoinfoinfoinfo')
            // 我的合同
            if(this.info.id == 'myContract'){
                this.$nextTick(()=>{
                    this.$refs.myContract.setValue(this.form[this.info.id], JSON.stringify(this.formData[this.info.id]), this.rules[this.info.id], this.formDisabled,this.info.id == 'onLineAnswer' ? 'onLineAnswer' : '')
                })
            }
            if(this.info.id == 'address'){
               this.$api.study.address.detail().then((res)=>{
                    this.form[this.info.id] = res.data || {}
                    if(res.data&&res.data.area){
                        this.form[this.info.id].area = res.data.area.split('-')
                    }
                    this.$nextTick(()=>{
                        this.formDisabled = 'add';
                        this.$refs.formBox.setValue(this.form[this.info.id], JSON.stringify(this.formData[this.info.id]), this.rules[this.info.id], this.formDisabled,this.info.id == 'onLineAnswer'? 'onLineAnswer' : '')
                    })
               })
            }
            if(this.info.id == 'information'){
               this.$api.study.information.detail().then((res)=>{
                    this.form[this.info.id] = res.data || {}
                    // deMobile1: localStorage.getItem('userInfo')?JSON.parse(localStorage.getItem('userInfo')).mobile.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2'):'',
                    this.form[this.info.id].mobile = this.form[this.info.id]&&this.form[this.info.id].mobile?this.form[this.info.id].mobile.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2'):''
                    this.$nextTick(()=>{
                        this.formDisabled = 'details';
                        this.$refs.formBox.setValue(this.form[this.info.id], JSON.stringify(this.formData[this.info.id]), this.rules[this.info.id], this.formDisabled,this.info.id == 'onLineAnswer'? 'onLineAnswer' : '')
                    })
               })
            }
            // 表格
            if(this.gridOptions[this.info.id]&&!this.info.isHead){
                this.findList()
                this.$nextTick(()=>{
                    this.$refs.formBox.reset()

                })
            }
            // 有筛选的
            if(this.info.isHead&&this.info.id != 'errAnswer'&&this.info.id != 'collectAnswer'){
                this.getTestpaper()
                this.getThird()
            }else if(this.info.id != 'errAnswer'&&this.info.isHead || this.info.id != 'collectAnswer'&&this.info.isHead){
                this.$router.push({
                    path:'/test',
                    query:{
                        type:this.info.id != 'errAnswer'?1:0
                    }
                })
            }else if(this.info.id ==  'errAnswer' || this.info.id ==  'collectAnswer'){ //错题
                this.$router.push({
                    path:'/test',
                    query:{
                        type:this.info.id != 'errAnswer'?1:0
                    }
                })
            }
            // 进来就是表单页面的
            if(this.isForm[this.info.id]&&this.info.id != 'address'&&this.info.id != 'information'){
                this.$nextTick(()=>{
                    this.$refs.formBox.reset()
                    
                    this.formDisabled = 'add';
                    this.$refs.formBox.setValue(this.form[this.info.id], JSON.stringify(this.formData[this.info.id]), this.rules[this.info.id], this.formDisabled,this.info.id == 'onLineAnswer' ? 'onLineAnswer' : '')
                })
            }
            // 新增的表单下拉框有初始值的
            if(this.config[this.info.id]){
                console.log(this.config[this.info.id],'this.config[this.info.id]')
                let para = this.config[this.info.id][1]?this.config[this.info.id][1]:{}
                this.config[this.info.id][0](para).then(res=>{
                    this.formData[this.info.id].map(e=>{
                        if(e.type== 'select'){
                            e.options = res.data.data || []
                        }
                    })
                })
            }
            
            if(this.checkboxs[this.info.id]){
                this.formData[this.info.id].map(e=>{
                    if(e.type== 'select1'){
                        e.options = this.checkboxs[this.info.id]
                    }
                })
            }
        },
        testpaperClick(index,e){
            this.activeTestpaper = index
            this.testpaperTypeId = e.config_id
            this.menuChange();
        },
        // 获取试卷类型
        getTestpaper(){
            this.$api.getTestpaper().then(res=>{
                this.testpaper = res.data||[]
                if(res.data&&res.data.length>0){
                    this.testpaperTypeId = res.data[0].config_id
                }
            })
        },
        startToLearn(item,type) {
            if(this.info.id == "startAnswer" || this.info.id == "answerList" || this.info.id == "collectAnswer" || this.info.id == "errAnswer"){
                this.$router.push({
                    path:`/test/${item.time?item.time:120}/${item.score?item.score:0}/${item.num}/${item.testpaper_id}/${type==0?1:2}/${type}`,
                    query:{
                        logId:item.testpaperlog_id,
                        key:this.info.id,
                    }
                });
            }else if(this.info.id == "startStudy"  || this.info.id == "studyList"){
                this.$router.push(`/look/${item.course_id}`)
            }
            
        },
        handleReset() {
            this.$refs['esign'].reset() //清空画布
            this.resultImg = ''
        },
        selectCol(index,e){
            console.log(e,2222222)
            this.subjectActive = index
            this.projectid = e.config_id
            this.subjectChildList = []
            if(e){
                this.getmysubject()
            }
        },
        majorClick(index,e){
            this.majorActive = index
            this.subjectId = e.config_id
            this.menuChange();
        },
        yearClick(i,item){
            this.yearActive = item;
            this.menuChange();
        },
        // 获取科目
        getThird(){
            this.$api.third().then(res=>{
                this.subjectList = res.data || []
                if(res.data&&res.data.length>0){
                    this.projectid = res.data[0].config_id;
                    this.getmysubject();
                }
            })
        },
        getmysubject(){
            this.$api.mysubject({project:this.projectid}).then(res=>{
                this.subjectChildList= [{config_id:'-1',name:'全部'},...res.data] || [{config_id:'',name:'全部'}]
                // if(res.data&&res.data.length>0){
                    this.subjectId = this.subjectChildList[0].config_id;
                    this.menuChange();
                // }
            })
        },
        menuChange(){
            console.log('切换');
            // this.gridOptions.loading = true
            try {
                let params = {}
                params = {...params,...this.paramsKey[this.info.id].query}
                if(this.info.id != 'errAnswer'&&this.info.id != 'collectAnswer'){
                    params[this.paramsKey[this.info.id].list['projectid']] = this.projectid
                    params[this.paramsKey[this.info.id].list['subjectId']] = this.subjectId
                    if(!this.projectid||!this.subjectId) return
                    // if()"startAnswer" "answerList"
                }
                console.log(this.info.id,111111)
                if(this.info.id == "startAnswer" || this.info.id == "answerList"){

                    params['type'] = this.testpaperTypeId
                    console.log(params,this.info.id,22222)

                }else{
                    params[this.paramsKey[this.info.id].list['yearActive']] = this.yearActive
                }
                console.log(params,this.info.id,3333)

                params[this.paramsKey[this.info.id].list['subjectId']] == '-1'?params[this.paramsKey[this.info.id].list['subjectId']] = '':''
                this.api[this.info.id].list(params).then(res=>{
                    if(this.info.id != 'startStudy'){
                        if(this.info.id != 'errAnswer'&&this.info.id != 'collectAnswer'){
                            this.lists[this.info.id] = res.data.data||[]
                        }else[
                            // console.log(this.info.id,res,'768908765yuhjhbv hgb')
                            // this.lists[this.info.id] = res.data||[]
                            console.log(res,'876578687687')

                        ]
                        console.log(res.data)
                    }else{
                        console.log(res,'876578687687')

                        this.lists[this.info.id] = res.data||[]
                        console.log(res.data)
                    }
                    
                })
            } catch (error) {
                console.error(error)
            }
            
        },
        // get
        // handleGenerate () {
        //     this.$refs['esign'].generate().then(res => {
        //         console.log(res, 'generate')
        //         this.resultImg = res // 得到了签字生成的base64图片
        //     }).catch(err => { //  没有签名，点击生成图片时调用
        //         this.$message({
        //             message: err + ' 未签名！',
        //             type: 'warning'
        //         })
        //         alert(err) // 画布没有签字时会执行这里 'Not Signned'
        //     })

        //  },
        handleGenerate() {
            this.$refs['esign'].generate().then(res => {
                this.$nextTick(() => {
                    this.resultImg = res
                    console.log(res, '0987657890876')

                })
                const bl = this.dataURLtoFile(res, 'a.png');
                console.log(bl, 'jkhjbjk');
                const formData = new FormData();
                formData.append("file", bl, Date.now() + ".png");
                console.log(formData, ';ljqhvhgb');
                // uploadGrayFile(formData).then((response) => {
                //     if (response.code == 200) {
                //     this.resultImageUrl = response.path
                //     this.$message({
                //         message: '签名上传成功！',
                //         type: 'success'
                //     })
                //     return;
                //     }
                //     this.$vux.loading.hide();
                //     this.$toast("签名上传失败！");
                // })
                // }).catch(err => { //  没有签名，点击生成图片时调用
                //     this.$message({
                //         message: '请先签名！',
                //         type: 'warning'
                //     })
                // // alert(err) // 画布没有签字时会执行这里 'Not Signned'
            })
        },
        convertBase64UrlToBlob(urlData) {
            const type = "image/png";
            let bytes = null;
            if (urlData.split(",").length > 1) {
                bytes = window.atob(urlData.split(",")[1]);
            } else {
                bytes = window.atob(urlData);
            }
            let ab = new ArrayBuffer(bytes.length);
            let ia = new Uint8Array(ab);
            for (let i = 0; i < bytes.length; i++) {
                ia[i] = bytes.charCodeAt(i);
            }
            return new Blob([ab], { type });
        },
        /**
         * Base64字符串转File文件
         * @param {String} dataurl Base64字符串(字符串包含Data URI scheme，例如：data:image/png;base64, )
         * @param {String} filename 文件名称
         */
        dataURLtoFile(dataurl, filename) {
            let arr = dataurl.split(',');
            let mime = arr[0].match(/:(.*?);/)[1];
            let bstr = atob(arr[1]);
            let n = bstr.length;
            let u8arr = new Uint8Array(n);
            while (n--) {
                u8arr[n] = bstr.charCodeAt(n);
            }
            return new File([u8arr], filename, {
                type: mime
            });
        },
        add() {
            this.dialogVisible = true;
            this.formDisabled = 'add';
            this.form[this.info.id] = {}
            if(this.info.id == 'onLineComplaint'){
                this.$nextTick(()=>{
                    this.$refs.formBox.setImageUrl('')
                })
            }

        },
        editRow(row){
            this.dialogVisible = true;
            this.formDisabled = 'edit';
            this.form[this.info.id] = row
            console.log(row,999999999);

        },
        deleteRow(id){
            this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    let url = this.info.id == 'address' ? this.api[this.info.id].delete : this.api[this.info.id].delete
                    let params = {}
                    params[this.idKeys[this.info.id]] = id

                    url(params).then(res=>{
                        if(res.status == 200){
                            // this.$message({
                            //     message: '删除成功！',
                            //     type:'success'
                            // })
                            this.findList()
                        }
                    })
                    // this.$message({
                    //     type: 'success',
                    //     message: '删除成功!'
                    // });
                }).catch(() => {
                //     this.$message({
                //         type: 'info',
                //         message: '已取消删除'
                // });          
            });
            // this.dialogVisible = true;
            // this.formDisabled = 'add';
            


        },
        detailsRow(row){
            this.dialogVisible = true;
            this.formDisabled = 'details';
            this.form[this.info.id] = row
            if(this.info.id == 'onLineComplaint'){
                this.$nextTick(()=>{
                    this.$refs.formBox.setImageUrl(row.image)
                })
            }
        },
        handlePageChange({ currentPage, pageSize }){
            this.gridOptions[this.info.id].pagerConfig.currentPage = currentPage
            this.gridOptions[this.info.id].pagerConfig.pageSize = pageSize
            this.findList()
        },
        findList () {
            this.gridOptions.loading = true
            let params = {}
            if(true){
                params = {
                    limit:this.gridOptions[this.info.id].pagerConfig.pageSize,
                    page:this.gridOptions[this.info.id].pagerConfig.currentPage,
                }
            }else{

            }
            console.log(this.api,this.api[this.info.id],'1213122131wqadsadcws')
            this.api[this.info.id].list(params).then(res=>{
                this.gridOptions.loading = false
                this.gridOptions[this.info.id].pagerConfig.total = res.data.total
                this.gridOptions[this.info.id].data = res.data.data||[]
            })
            // setTimeout(() => {
            //     this.gridOptions[this.info.id].data = [
            //         { id: 10001, name: 'Test1', nickname: 'T1', role: 'Develop', sex: '1', age: 28, address: 'Shenzhen' },
            //         { id: 10002, name: 'Test2', nickname: 'T2', role: 'Test', sex: '0', age: 22, address: 'Guangzhou' },
            //         { id: 10003, name: 'Test3', nickname: 'T3', role: 'PM', sex: '1', age: 32, address: 'Shanghai' },
            //         { id: 10004, name: 'Test4', nickname: 'T4', role: 'Designer', sex: '0', age: 23, address: 'Shenzhen' },
            //         { id: 10005, name: 'Test5', nickname: 'T5', role: 'Develop', sex: '0', age: 30, address: 'Shanghai' },
            //         { id: 10006, name: 'Test6', nickname: 'T6', role: 'Develop', sex: '0', age: 27, address: 'Shanghai' },
            //         { id: 10007, name: 'Test7', nickname: 'T7', role: 'Develop', sex: '1', age: 29, address: 'Shenzhen' },
            //         { id: 10008, name: 'Test8', nickname: 'T8', role: 'Develop', sex: '0', age: 32, address: 'Shanghai' },
            //         { id: 10009, name: 'Test9', nickname: 'T9', role: 'Develop', sex: '1', age: 30, address: 'Shenzhen' },
            //         { id: 10010, name: 'Test10', nickname: 'T10', role: 'Develop', sex: '0', age: 34, address: 'Shanghai' }
            //     ]
            // }, 300)
        },
        open() {
            console.log("Open")
            // this.formDisabled = 'add'
            this.$nextTick(() => {
                if(this.info.id == 'score'){
                    this.$refs.scoreAdd.setValue(this.form[this.info.id], JSON.stringify(this.formData[this.info.id]), this.rules[this.info.id], this.formDisabled)
                }else{
                    this.$refs.formBox.setValue(this.form[this.info.id], JSON.stringify(this.formData[this.info.id]), this.rules[this.info.id], this.formDisabled,this.info.id == 'onLineAnswer' ? 'onLineAnswer' : '')

                }
            })
        },
        submit(e) {
            console.log(e,this.uploadUrl, 777777)
            let form = JSON.parse(JSON.stringify(e))
            if(this.info.id == 'onLineTeacher'){
                form.normal = e.normal?1:0
            }
            if(this.info.id == 'onLineComplaint'){
                form.image = this.uploadUrl
            }
            let url = this.isForm[this.info.id] ? this.api[this.info.id]&&this.api[this.info.id].add?this.api[this.info.id].add:this.api[this.info.id] : this.api[this.info.id][this.formDisabled]
            if(this.info.id == 'address'){
                form.area = form.area.join('-')
                form.often = 1
            }
            url(form).then((res) => {
                if(res.status == 200){
                    this.findList()
                    if(this.info.id == 'onLineAnswer'){
                        this.$refs.formBox.clearEditor()
                    }
                    this.dialogVisible = false
                }else{

                }
                // this.$message({
                //     message: res.msg,
                //     type: 'success'
                // })
            })
        },
        submitClick() {
            if(this.info.id == 'score'){
                    this.$refs.scoreAdd.submitForm()
                }else if(this.isForm[this.info.id]){
                    this.$refs.formBox.submitForm()
                } else{
                     this.$refs.formBox.submitForm()
                }
        },
        imageClick(img){
            this.imageDig = true
            this.defaultImage = img
        },
        dowonLoad(url){
            console.log(url,3333)
        },

    }
}
</script>
<style lang="scss" scoped>
:deep .el-cascader-node.in-active-path,
.el-cascader-node.is-active,
.el-cascader-node.is-selectable.in-checked-path {
    color: #ccc;
}
.vxe-cell1{
    display: flex;
    align-items: center;
    height: 100%;
}
.btn {
    display: inline-block;
    margin-left: 30px;

    ::v-deep .el-button {
        background-color: var(--bg-color, 'red');
        color: var(--color, 'red');
    }
}
</style>